package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Classinfo;
import cn.wolfcode.domain.Employee;
import cn.wolfcode.mapper.ClassinfoMapper;
import cn.wolfcode.qo.EmplyeeQueryObject;
import cn.wolfcode.service.ClassinfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassinfoServiceImpl implements ClassinfoService{

    @Autowired
    private ClassinfoMapper classinfoMapper;


    @Override
    public void deleteByPrimaryKey(Long id) {
        classinfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insert(Classinfo classinfo) {
        classinfoMapper.insert(classinfo);
    }

    @Override
    public Classinfo selectByPrimaryKey(Long id) {
        Classinfo classinfo = classinfoMapper.selectByPrimaryKey(id);
        return classinfo;
    }

    @Override
    public List<Classinfo> selectAll() {
        List<Classinfo> classinfos = classinfoMapper.selectAll();
        return classinfos;
    }

    @Override
    public void updateByPrimaryKey(Classinfo classinfo) {

        classinfoMapper.updateByPrimaryKey(classinfo);
    }

    @Override
    public PageInfo<Classinfo> query(EmplyeeQueryObject qo) {

        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Classinfo> classinfos = classinfoMapper.selectForList(qo);
        return new PageInfo<>(classinfos);
    }
}
